#include "callbacksimplebanner.h"
#include "adviewcontrol.h"
#include <QPushButton>
#include <QMessageBox>

callbacksimplebanner::callbacksimplebanner()
{
    pBanner = new AdViewControl(this);
    QPushButton* button = new QPushButton(this);
    button->setText("close");
    button->setGeometry(QRect(0,250,100,50));
    connect(button,SIGNAL(clicked()),this,SLOT(onclick()));

    if (pBanner){
            pBanner->setGeometry(QRect(0,0,340,200));
            pBanner->set_Zone("20249");

            pBanner->set_Site("8061");
            pBanner->set_InternalBrowser(true);

            pBanner->set_HorizontalAlignment(AdViewControl::HORZ_CENTER);
            pBanner->set_VerticalAlignment(AdViewControl::VERT_CENTER);
            pBanner->set_UpdateTime(15);

            connect(pBanner,SIGNAL(AdDownloadBegin()),this,SLOT(onAdDownloadBegin()));
            connect(pBanner,SIGNAL(AdDownloadEnd()),this,SLOT(onAdDownloadEnd()));
            connect(pBanner,SIGNAL(AdWebViewClosing(QString)),this,SLOT(onAdWebViewClosing(QString)));


            pBanner->Update();

    }
}
void callbacksimplebanner::onAdDownloadEnd()
{
    QMessageBox msg;
    msg.setText("onAdDownloadEnd");
    msg.exec();
}

void callbacksimplebanner::onAdWebViewClosing(QString str)
{
    QMessageBox msg;
    msg.setText("onAdWebViewClosing " + str);
    msg.exec();
}


void callbacksimplebanner::onAdDownloadBegin()
{
    QMessageBox msg;
    msg.setText("onAdDownloadBegin");
    msg.exec();
}

void callbacksimplebanner::onclick()
{
    this->done(QDialog::Rejected);
}
